package cn.com.chujie.groovydemo.controller;

import cn.com.chujie.groovydemo.entity.HelloEntity;
import cn.com.chujie.groovydemo.service.HelloService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class HelloController {
    @Resource
    HelloService helloService;

    @GetMapping("/helloWord")
    public String helloWord() {
        helloService.insertEntity(makeHelloEntity());
        return "HelloWord";
    }

    private HelloEntity makeHelloEntity() {
        HelloEntity helloEntity = new HelloEntity();
        helloEntity.setId("1");
        helloEntity.setName("123");
        return helloEntity;
    }
}
